<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */

//取出此期賽程
$arrGamble = getNewGambleData($intLID, 0);
if($arrGamble === false){
	ErrMsgOutputHTML("Error", "", 1);
}
if(sizeof($arrGamble) == 0){
	$arrGamble = getNewGambleData($intLID, 1);
	if($arrGamble === false){
		ErrMsgOutputHTML("Error", "", 1);
	}
}
$intGID = $arrGamble["ID"];
$intEGTime = 0;
if(!empty($intGID)){
	$_strGDate = DateForm($arrGamble["GameDate"], $arrGamble["GameTime"], "Y-m-d", "UToC")."&nbsp;".TimeForm($arrGamble["GameDate"], $arrGamble["GameTime"], "h:i a", "UToC");

	$arrEGTime = explode(":", $arrGamble["EndGameTime"]);
	$arrGDate = explode("-", $arrGamble["GameDate"]);
	$intEGTime = mktime($arrEGTime[0], $arrEGTime[1], $arrEGTime[2], $arrGDate[1], $arrGDate[2], $arrGDate[0]) - time();
}

$arrTmp = split("-", $arrLotto["Number"]);
for($i = intval($arrTmp[0]); $i <= intval($arrTmp[1]); $i++)$_strNumber .= $i.",";
$_strNumber = substr($_strNumber, 0, strlen($_strNumber) - 1);

$arrMaxOdds = array();
$arrJumpOdds = array();
$arrGLineNumToApointNum = array();
for($i = 1; $i <= sizeof($_arrBetParam); $i++){
	$arrMaxOdds[] = "MaxOdds[".($i + 50)."] = new Array()";
	$arrJumpOdds[] = "arrJumpOdds[".($i + 50)."] = new Array()";
	$arrGLineNumToApointNum[] = "arrGLineNumToApointNum[".($i + 50)."] = new Array()";
	foreach($_arrBetParam[($i+50)] as $intAN => $arrParam){
		$arrMaxOdds[] = "MaxOdds[".($i + 50)."][".$intAN."] = ".$arrParam["maxOdds"];
		$arrJumpOdds[] = "arrJumpOdds[".($i + 50)."][".$intAN."] = ".$arrParam["StakeJumpRate"];
	}
}
?><!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> <?php print $_strGamble["Title"];?> (Add) </title>
<link rel="stylesheet" href="../../css/backend.css?time=01" type="text/css">
<script language="JavaScript1.2" type="text/javascript" src="/inc/OperateTemp3D<?php print $_intLang?>.js?time=01"></script>
<script language="JavaScript1.2" type="text/javascript" src="/inc/admin_envirset.js"></script>
<script language="JavaScript">
<!--
var Game51 = new Array(), Game52 = new Array(), Game53 = new Array(), Game84 = new Array();
var Game54 = new Array(), Game55 = new Array(), Game56 = new Array(), Game85 = new Array();
var Game57 = new Array(), Game58 = new Array(), Game59 = new Array(), Game60 = new Array(), Game86 = new Array();
var Game61 = new Array(), Game62 = new Array(), Game63 = new Array();
var Game64 = new Array(), Game65 = new Array(), Game66 = new Array(), Game67 = new Array();
var Game68 = new Array(), Game69 = new Array(), Game70 = new Array(), Game71 = new Array(), Game72 = new Array();
var Game73 = new Array(), Game74 = new Array(), Game75 = new Array(), Game76 = new Array(), Game77 = new Array();
var Game78 = new Array(), Game79 = new Array(), Game80 = new Array(), Game81 = new Array(), Game82 = new Array(), Game83 = new Array();
var Game87 = new Array(), Game88 = new Array(), Game89 = new Array(), Game90 = new Array(), Game91 = new Array();
var Game92 = new Array(), Game93 = new Array();
//var strGameTime = "<?php print $_strGDate;?>";
//var strGameNo = "<?php print $arrGamble["SerialNo"];?>";
var intSortPlus = -1;
var arrSpecialNum = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var arrSpecialCon = new Array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
var strLottoID = "<?php print $intLID;?>";
var strBetType = "51,52,53,54,55,56,57,58,59,60,61,62,63,84,85,86";
var RSeconds = 0;
var isEmergency = 0;
var strOnEmergency = "<?php print $_strOperate["OnEmergency"];?>";
var intEmergencyNo = 0;
var AutoRefreshID = 0;
var intEndGameTime = <?php print (int)$intEGTime;?>;
var sumStake = new Array(), sumPayOff = new Array(), sumCommission = new Array(), sumWStake = new Array();

var strT51 = "<?php print $_strOperate3D["Bet51"];?>", strT64 = "<?php print $_strOperate3D["Bet64"];?>", strT67 = "<?php print $_strOperate3D["Bet67"];?>", strT68 = "<?php print $_strOperate3D["Bet68"];?>", strT73 = "<?php print $_strOperate3D["Bet73"];?>", strT78 = "<?php print $_strOperate3D["Bet78"];?>", strT87 = "<?php print $_strOperate3D["Bet87"];?>", strT92 = "<?php print $_strOperate3D["Bet92"];?>", strT93 = "<?php print $_strOperate3D["Bet93"];?>", strTSG = "<?php print $_strOperate3D["StartGame"];?>";

var MaxOdds = new Array();
var arrJumpOdds = new Array();
<?php 
	print implode("; ", $arrMaxOdds).";";
	print implode("; ", $arrJumpOdds).";";
?>
var intSortSite = 0;
var isShowAVOdds = "<?php print $isShowAVOdds;?>";
var arrTwin = new Array();
arrTwin[64] = "<?php print $_strOperate3D["DecUnit"];?>";
arrTwin[65] = "<?php print $_strOperate3D["CentUnit"];?>";
arrTwin[66] = "<?php print $_strOperate3D["CentDec"];?>";

var arrGLineNumToApointNum = new Array();
<?php 	print implode("; ", $arrGLineNumToApointNum).";";?>

arrGLineNumToApointNum[61] = {'6':0, '7':1, '8':2, '9':3, '10':4, '11':5, '12':6, '13':7, '14':7, '15':6, '16':5, '17':4, '18':3, '19':2, '20':1, '21':8};
arrGLineNumToApointNum[67] = {'0':1, '11':1, '22':1, '33':1, '44':1, '55':1, '66':1, '77':1, '88':1, '99':1};
arrGLineNumToApointNum[90] = {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9};
arrGLineNumToApointNum[93] = {	'1':1, '2':1, '3':1, '4':1, '5':1, '6':1, '7':1, '8':1, '9':1,
		'11':1, '22':1, '33':1, '44':1, '55':1, '66':1, '77':1, '88':1, '99':1, 
		'112':1, '113':1, '114':1, '115':1, '116':1, '117':1, '118':1, '119':1, 
		'122':1, '133':1, '144':1, '155':1, '166':1, '177':1, '188':1, '199':1, 
		'223':1, '224':1, '225':1, '226':1, '227':1, '228':1, '229':1, 
		'233':1, '244':1, '255':1, '266':1, '277':1, '288':1, '299':1, 
		'334':1, '335':1, '336':1, '337':1, '338':1, '339':1, '344':1, '355':1, '366':1, '377':1, '388':1, '399':1, 
		'445':1, '446':1, '447':1, '448':1, '449':1, '455':1, '466':1, '477':1, '488':1, '499':1, 
		'556':1, '557':1, '558':1, '559':1, '566':1, '577':1, '588':1, '599':1, 
		'667':1, '668':1, '669':1, '677':1, '688':1, '699':1, 
		'778':1, '779':1, '788':1, '799':1, 
		'899':1,'889':1, 
		'0':2, '111':2, '222':2, '333':2, '444':2, '555':2, '666':2, '777':2, '888':2, '999':2
};

//定膽初始化
function iniNumber(intBetType){
	var arrNumber = new Array();
	if(intBetType == 51){
		document.getElementById("ListStatus").innerHTML = strT51;
		document.getElementById("BetList").innerHTML = strLayer5163;
	}
	GetOdds();
}

function changEmergency(){
	if(null == document.getElementById("EmergencyLink"))return;
	document.getElementById("EmergencyLink").innerHTML = (isEmergency == 0)?"<?php print $_strOperate3D["EmergencyOff"];//緊急關閉?>":"<?php print $_strOperate3D["EmergencyOpen"];//系統開放?>";
	document.getElementById("EmergencyLink").className = (isEmergency == 0)?"G_Con_Emergency_Off":"G_Con_Emergency_On";
}

function takeEmergency(){
	with(document.getDataForm){
		op.value = "OffAllWager";
		if(isEmergency == 0)if(!confirm("<?php print $_strOperate3D["EmergencyOffAlert"];?>"))return;
		intEmergency.value = (isEmergency == 0)?"1":"0";
		submit();
	}
}

function changSort(){
	intSortPlus *= -1;
	changSortClass();
	RefreshType();
}

function changSortClass(){
	document.getElementById("TenSortLink").innerHTML = (intSortPlus == -1)?"<?php print $_strOperate3D["TenLoseSort"];//二十大負值排行?>":"<?php print $_strOperate3D["TenWinSort"];//二十大正值排行?>";
	document.getElementById("TenSortTD").className = (intSortPlus == -1)?"G_Con_SortLoseTD":"G_Con_SortWinTD";
}

function ValueSort(arrValue, intValue, intNum, strCon){
	var i = 0, intTmp = 0, intTmp2 = 0, isMoveDown = false, strCon1 = "", strCon2 = "", intNum1 = 0, intNum2 = 0;
	for(i = 0; i < arrValue.length; i++){
		if(isMoveDown == false){
			if(arrValue[i] < intValue){
				intTmp = arrValue[i];
				intNum1 = arrSpecialNum[i];
				strCon1 = arrSpecialCon[i];
				arrValue[i] = intValue;
				arrSpecialNum[i] = intNum;
				arrSpecialCon[i] = strCon;
				isMoveDown = true;
			}
		}else{
			if(isMoveDown == true){
				intTmp2 = arrValue[i];
				intNum2 = arrSpecialNum[i];
				strCon2 = arrSpecialCon[i];
				arrValue[i] = intTmp;
				arrSpecialNum[i] = intNum1;
				arrSpecialCon[i] = strCon1;
				intTmp = intTmp2;
				intNum1 = intNum2;
				strCon1 = strCon2;
			}
		}
	}
	return arrValue;
}

function getPlusMinusForm(intGID, intBT, intNum, flOdds, intSNum){
	var strCon = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td onclick=\"PlusMinusOdds(1, "+intNum+", "+intBT+","+flOdds+");\" class=\"G_Con_Odds_Plus\">+</td>";
		
	strCon += "<td align=\"center\"><a class=\"G_Con_Odds\" href=\"JavaScript:ShowOddsLayer("+intGID+","+intBT+","+intNum+","+flOdds+","+intSNum+")\">"+flOdds+"</a></td>";

	strCon += "<td onclick=\"PlusMinusOdds(0, "+intNum+", "+intBT+","+flOdds+");\" class=\"G_Con_Odds_Minus\">-</td></tr></table>";

	return strCon;
}

//顯示數字賠率，給 iframe 用
function ShowNumberOdds51(intBT){
	var intNum = 0, strTD = "", strTip = "", arrTmpGame = new Array(), sumOdds = 0, maxPayOff = 0, intTmp = 0, OverBetOn, OverBet, OverBetColor, intBT, preWin = 0, strClass = "", strCon = "", flOdds = 0, flComm;// sumPayOff = 0,
	var arrBT = new Array(51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 84, 85, 86);
	var arrBTMinNum = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0);
	var arrBTMaxNum = new Array(9, 1, 1, 9, 1, 1, 9, 1, 1, 9, 21, 1, 1, 1, 1, 1);
	var strTDSite = "";

	for(var i = 0; i < arrBT.length; i++){
		intBT = arrBT[i];
		arrTmpGame = eval("Game" + intBT.toString());

		for(var intNum = arrBTMinNum[i]; intNum <= arrBTMaxNum[i]; intNum++){
			intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
			preWin = sumStake[intBT] - intTmp - sumCommission[intBT];
			strClass = (preWin > 0)?"G_Con_Result_Win":"G_Con_Result_Lose";

			strTDSite = intBT.toString() + "_" + intNum.toString();
			if ((OverBetOn == 1) && (arrTmpGame[intNum][8] >= OverBet)) {
				document.getElementById("OddsTD"+strTDSite).style.background = OverBetColor;
			}
			document.getElementById("OddsTD"+strTDSite).innerHTML = getPlusMinusForm(arrTmpGame[intNum][1], intBT, intNum, arrTmpGame[intNum][5], intNum);

			strCon = "<a class=\"G_Con_Bet\" href=\"JavaScript: intSortSite=0;getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+intNum+",0,"+intNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a> / <a class=\""+strClass+"\">"+Math.round(preWin).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

			document.getElementById("Num"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
			document.getElementById("OddsTD"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

			sumOdds += 1 / parseFloat(arrTmpGame[intNum][5]);
			intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
			document.getElementById("WagerTD"+strTDSite).innerHTML = strCon;
		}
		switch(intBT){
			case 51:
			case 54:
			case 57:
			case 60:
			case 61:
				document.getElementById("SumWagerTD"+intBT.toString()).innerHTML = sumStake[intBT];
				break;
		}
	}	//for(var i = 0; i < arrBT.length; i++)
}

//取得三定位 號碼組合
function getTrinityNumber(){
	for(var i = 0; i < document.OddsListForm["STrinity"].length; i++)if(document.OddsListForm["STrinity"][i].checked)var strTrinity = document.OddsListForm["STrinity"][i].value;
	for(var i = 0; i < document.OddsListForm["STrinityNo"].length; i++)if(document.OddsListForm["STrinityNo"][i].checked)var strSTriNo = document.OddsListForm["STrinityNo"][i].value;

	var arrTriNum = new Array();
	for(var i = 0; i <= 9; i++){
		for(var j = 0; j <= 9; j++){
			switch(strTrinity){
				case "Cent":
					arrTriNum[i*10 + j] = strSTriNo*100 + i*10 + j*1;
					break;
				case "Dec":
					arrTriNum[i*10 + j] = i*100 + strSTriNo*10 + j*1;
					break;
				case "Unit":
					arrTriNum[i*10 + j] = i*100 + j*10 + strSTriNo*1;
					break;
			}
		}
	}
	document.getDataForm.strLottoNumber.value = arrTriNum.join(",");
}

//三定位 初始化
function iniTrinityNumber(intBT){
	var strNum = "", strOtherMsg = "";
	if(null == document.getElementById("TrinityTD"))document.getElementById("BetList").innerHTML = strLayer92;

	if(document.OddsListForm["STrinity"][0].checked){
		document.getDataForm.OtherMsg.value = "Sort";
	}else{
		document.getDataForm.OtherMsg.value = "";
		getTrinityNumber();
	}
	GetOdds();
}

//三定位 賠率表
function ShowTrinityNumber(intBT){
	var intNum, arrTmpGame = new Array(), objOTD, objNTD, intTmp = 0, preWin = 0, strClass = "", strNum = "", intSNum;

	//雙飛
	arrTmpGame = eval("Game" + intBT.toString());
	for(intNum = 0; intNum <= 99; intNum++){
		intSNum = intNum;
		if(document.OddsListForm["STrinity"][0].checked){
			intSNum = (intNum % 10)*10 + Math.floor(intNum / 10);
			//alert(intSNum);
		}
		strNum = arrTmpGame[intNum][3];

		intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
		preWin = sumStake[intBT] - intTmp - sumCommission[intBT];
		strClass = (preWin > 0)?"G_Con_Result_Win":"G_Con_Result_Lose";

		objNTD = document.getElementById("Num92_"+intSNum.toString());
		objOTD = document.getElementById("OddsTD92_"+intSNum.toString());

		strCon = getPlusMinusForm(arrTmpGame[intNum][1], arrTmpGame[intNum][2], strNum, arrTmpGame[intNum][5], intSNum);
		strCon += "<a class=\"G_Con_Bet\" href=\"JavaScript: getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+strNum+",0,"+intSNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a><br /><a class=\""+strClass+"\">"+Math.round(preWin).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

		if(strNum.length == 1)strNum = "00"+strNum;
		if(strNum.length == 2)strNum = "0"+strNum;
		objNTD.innerHTML = "<a href='JavaScript:StopBet("+intBT.toString()+", "+intNum+")' class='G_Con_Numer_blue' id='NumSB92_"+intSNum.toString()+"'>" + strNum + "</a>";
		objNTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
		objOTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

		objOTD.innerHTML = strCon;
	}
	document.getElementById("TwinSumStake").innerHTML = sumStake[intBT];
}

//雙飛 初始化
function iniTwinNumer(intBT){
	var strNum = "";
	document.getElementById("ListStatus").innerHTML = (strBetType == "67")?strT67:(strT64 + "-" + arrTwin[intBT]);
	document.getElementById("BetList").innerHTML = strLayer6467;
	if(document.getElementById("Num64_99").innerHTML == "99"){
		for(var i = 0; i <= 99; i++){
			if(strBetType == "67"){
				if(Math.floor(i / 10) > (i % 10)){
					document.getElementById("Num64_"+i.toString()).innerHTML = "";
					continue;
				}
			}

			strNum = i.toString();
			if(i < 10)strNum = "0" + strNum;
			document.getElementById("Num64_"+i.toString()).innerHTML = "<a href='JavaScript:StopBet("+intBT.toString()+", "+i.toString()+")' class='G_Con_Numer_blue'>" + strNum + "</a>";
		}
	}
	if(strBetType == "67"){
		document.getElementById("TwinTypeTD").style.display = "none";
	}else{
		document.getElementById("TwinBT"+intBT).checked = true;
	}
	GetOdds();
}

//顯示 雙飛 賠率表
function ShowTwinNumer(intBT){
	var intNum, arrTmpGame = new Array(), objOTD, objNTD, intTmp = 0, preWin = 0, strClass = "";
	var arrN = new Array(-1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000);

	//雙飛
	arrTmpGame = eval("Game" + intBT.toString());
	for(intNum = 0; intNum <= 99; intNum++){
		if(strBetType == "67"){
			if(Math.floor(intNum / 10) > (intNum % 10))continue;
		}

		intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
		preWin = sumStake[intBT] - intTmp - sumCommission[intBT];
		strClass = (preWin > 0)?"G_Con_Result_Win":"G_Con_Result_Lose";

		objNTD = document.getElementById("Num64_"+intNum.toString());
		objOTD = document.getElementById("OddsTD64_"+intNum.toString());

		strCon = getPlusMinusForm(arrTmpGame[intNum][1], arrTmpGame[intNum][2], intNum.toString(), arrTmpGame[intNum][5], intNum);
		strCon += "<a class=\"G_Con_Bet\" href=\"JavaScript: getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+intNum.toString()+",0,"+intNum.toString()+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a><br /><a class=\""+strClass+"\">"+Math.round(preWin).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

		arrN = ValueSort(arrN, preWin*intSortPlus, intNum, strCon);

		objNTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
		objOTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

		objOTD.innerHTML = strCon;
	}
	document.getElementById("TwinSumStake").innerHTML = sumStake[intBT];

	changSortClass();
	for(var i = 0; i < arrSpecialNum.length; i++){
		intNum = arrSpecialNum[i];
		objNTD = document.getElementById("NumSort64_"+(i+1).toString());
		objOTD = document.getElementById("OddsTDSort64_"+(i+1).toString());

		objNTD.innerHTML = "<a href=\"JavaScript:StopBet("+intBT+", "+intNum+")\" class=\"G_Con_Numer_Green\">" + ((intNum < 10)?"0"+intNum:intNum) + "</a>";
		//alert(arrSpecialCon[i]);
		arrSpecialCon[i] = arrSpecialCon[i].replace("ShowOddsLayer", "intSortSite="+(i+1)+";ShowOddsLayer");
		arrSpecialCon[i] = arrSpecialCon[i].replace("ShowOddsLayer", "intSortSite="+(i+1)+";ShowOddsLayer");
		//alert(arrSpecialCon[i]);
		objOTD.innerHTML = arrSpecialCon[i];
		objNTD.className = document.getElementById("Num64_"+intNum.toString()).className + "_Sort";
		objOTD.className = document.getElementById("OddsTD64_"+intNum.toString()).className+"_Sort";
	}
}

//雙飛 重置
function ResetTwinNumber(){
	document.OddsListForm.reset();
	document.getElementById("TwinBT"+document.getDataForm.Bet_Type.value).checked = true; 
	GetOpTypeNum();
}

//組 3 轉直 初始化
function iniAssembleNumer(intBT){
	document.getElementById("ListStatus").innerHTML = (intBT == 68)?strT68:strT73;
	document.getElementById("BetList").innerHTML = (intBT == 68)?strLayer6872:strLayer7377;
	GetOdds();
}

//顯示 組 3 轉直 數字賠率
function ShowAssembleNumber(intBT){
	var intNum = 0, strTD = "", strTip = "", arrTmpGame = new Array(), sumOdds = 0, maxPayOff = 0, intTmp = 0, OverBetOn, OverBet, OverBetColor, intBT, preWin = 0, strClass = "", strCon = "", flOdds = 0, flComm;// sumPayOff = 0,
	var arrBT = (intBT == 68)?new Array(68, 69, 70, 71, 72):new Array(73, 74, 75, 76, 77);
	var arrBTMinNum = new Array(0, 0, 0, 0, 0);
	var arrBTMaxNum = (intBT == 68)?new Array(0, 9, 9, 9, 9):new Array(9, 9, 9, 9, 9);
	var strTDSite = "";

	for(var i = 0; i < arrBT.length; i++){
		intBT = arrBT[i];
		arrTmpGame = eval("Game" + intBT.toString());

		for(var intNum = arrBTMinNum[i]; intNum <= arrBTMaxNum[i]; intNum++){
			strTDSite = intBT.toString() + "_" + intNum.toString();
			if ((OverBetOn == 1) && (arrTmpGame[intNum][8] >= OverBet)) {
				document.getElementById("OddsTD"+strTDSite).style.background = OverBetColor;
			}
			document.getElementById("OddsTD"+strTDSite).innerHTML = getPlusMinusForm(arrTmpGame[intNum][1], intBT, intNum, arrTmpGame[intNum][5], intNum);

			strCon = "<a class=\"G_Con_Bet\" href=\"JavaScript: intSortSite=0;getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+intNum+",0,"+intNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

			document.getElementById("Num"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
			document.getElementById("OddsTD"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

			sumOdds += 1 / parseFloat(arrTmpGame[intNum][5]);
			intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
			document.getElementById("WagerTD"+strTDSite).innerHTML = strCon;

		}
		if(intBT != 68)document.getElementById("SumWagerTD"+intBT.toString()).innerHTML = sumStake[intBT];
	}	//for(var i = 0; i < arrBT.length; i++)
}

//3x3x3 初始化
function iniRowsNumer(intBT){
	document.getElementById("ListStatus").innerHTML = strT78;
	document.getElementById("BetList").innerHTML = strLayer7882;
	GetOdds();
}

//顯示 3x3x3 數字賠率
function ShowRowsNumber(intBT){
	var intNum = 0, strTD = "", strTip = "", arrTmpGame = new Array(), sumOdds = 0, maxPayOff = 0, intTmp = 0, OverBetOn, OverBet, OverBetColor, intBT, preWin = 0, strClass = "", strCon = "", flOdds = 0, flComm;// sumPayOff = 0,
	var arrBT = new Array(78, 79, 80, 81, 82, 83);
	var arrBTMinNum = new Array(0, 0, 0, 0, 0, 0);
	var arrBTMaxNum = new Array(0, 0, 0, 0, 0, 0);
	var strTDSite = "";

	for(var i = 0; i < arrBT.length; i++){
		intBT = arrBT[i];
		arrTmpGame = eval("Game" + intBT.toString());

		for(var intNum = arrBTMinNum[i]; intNum <= arrBTMaxNum[i]; intNum++){
			strTDSite = intBT.toString() + "_" + intNum.toString();
			if ((OverBetOn == 1) && (arrTmpGame[intNum][8] >= OverBet)) {
				document.getElementById("OddsTD"+strTDSite).style.background = OverBetColor;
			}
			document.getElementById("OddsTD"+strTDSite).innerHTML = getPlusMinusForm(arrTmpGame[intNum][1], intBT, intNum, arrTmpGame[intNum][5], intNum);

			strCon = "<a class=\"G_Con_Bet\" href=\"JavaScript: intSortSite=0;getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+intNum+",0,"+intNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

			document.getElementById("Num"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
			document.getElementById("OddsTD"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

			sumOdds += 1 / parseFloat(arrTmpGame[intNum][5]);
			intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
			document.getElementById("WagerTD"+strTDSite).innerHTML = strCon;
		}
	}	//for(var i = 0; i < arrBT.length; i++)
}

//過關跨度 初始化
function iniOPNumer(intBT){
	document.getElementById("ListStatus").innerHTML = strT87;
	document.getElementById("BetList").innerHTML = strLayer8790;
	GetOdds();
}

//顯示 過關跨度 數字賠率
function ShowOPNumber(intBT){
	var intNum = 0, strTD = "", strTip = "", arrTmpGame = new Array(), sumOdds = 0, maxPayOff = 0, intTmp = 0, OverBetOn, OverBet, OverBetColor, intBT, preWin = 0, strClass = "", strCon = "", flOdds = 0, flComm;// sumPayOff = 0,
	var arrBT = new Array(87, 88, 89, 90, 91);
	var arrBTMinNum = new Array(0, 0, 0, 0, 0);
	var arrBTMaxNum = new Array(7, 7, 7, 9, 9);
	var strTDSite = "";

	for(var i = 0; i < arrBT.length; i++){
		intBT = arrBT[i];
		arrTmpGame = eval("Game" + intBT.toString());

		for(var intNum = arrBTMinNum[i]; intNum <= arrBTMaxNum[i]; intNum++){
			strTDSite = intBT.toString() + "_" + intNum.toString();
			if ((OverBetOn == 1) && (arrTmpGame[intNum][8] >= OverBet)) {
				document.getElementById("OddsTD"+strTDSite).style.background = OverBetColor;
			}
			document.getElementById("OddsTD"+strTDSite).innerHTML = getPlusMinusForm(arrTmpGame[intNum][1], intBT, intNum, arrTmpGame[intNum][5], intNum);

			strCon = "<a class=\"G_Con_Bet\" href=\"JavaScript: intSortSite=0;getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+intNum+",0,"+intNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

			document.getElementById("Num"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
			document.getElementById("OddsTD"+strTDSite).className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

			sumOdds += 1 / parseFloat(arrTmpGame[intNum][5]);
			intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
			document.getElementById("WagerTD"+strTDSite).innerHTML = strCon;

		}
		document.getElementById("SumWagerTD"+intBT.toString()).innerHTML = sumStake[intBT];
	}	//for(var i = 0; i < arrBT.length; i++)
}

//三字 初始化
function ini3WordNumber(intBT){
	var strNum = "", strOtherMsg = "";
	if(null == document.getElementById("TreeWordTD"))document.getElementById("BetList").innerHTML = strLayer93;

	if(document.OddsListForm["STrinity"][0].checked){
		document.getDataForm.OtherMsg.value = "Sort";
	}else{
		document.getDataForm.OtherMsg.value = "";
	}
	GetOdds();
}

//三字 賠率表
function Show3WordNumber(intBT){
	var intNum, arrTmpGame = new Array(), objOTD, objNTD, intTmp = 0, preWin = 0, strClass = "", strNum = "", intSNum;
	var arrColor = ["#000000", "#FF0000", "#330099", "#336600", "#660099", "#FF6600", "#660000", "#004080", "#800080", "#808000"];
	var strColor = "";

	arrTmpGame = eval("Game" + intBT.toString());
	for(intNum = 0; intNum <= 219; intNum++){
		intSNum = intNum;
		/*if(document.OddsListForm["STrinity"][0].checked){
			intSNum = (intNum % 10)*10 + Math.floor(intNum / 10);
		}*/
		strNum = arrTmpGame[intNum][3];

		intTmp = parseFloat(arrTmpGame[intNum][9]) + parseFloat(arrTmpGame[intNum][8]);
		preWin = sumStake[intBT] - intTmp - sumCommission[intBT];
		strClass = (preWin > 0)?"G_Con_Result_Win":"G_Con_Result_Lose";

		objNTD = document.getElementById("Num93_"+intSNum.toString());
		objOTD = document.getElementById("OddsTD93_"+intSNum.toString());

		strCon = getPlusMinusForm(arrTmpGame[intNum][1], arrTmpGame[intNum][2], strNum, arrTmpGame[intNum][5], intSNum);
		strCon += "<a class=\"G_Con_Bet\" href=\"JavaScript: getWagerData("+arrTmpGame[intNum][1]+","+arrTmpGame[intNum][2]+","+strNum+",0,"+intSNum+")\">"+Math.round(parseFloat(arrTmpGame[intNum][8])).toString()+"</a><br /><a class=\""+strClass+"\">"+Math.round(preWin).toString()+"</a>";//+arrTmpGame[intNum][7]+"/"

		strColor = arrColor[Math.floor(strNum*1 / 100)];
		if(strNum.length == 1)strNum = "00"+strNum;
		if(strNum.length == 2)strNum = "0"+strNum;
		objNTD.innerHTML = "<a href='JavaScript:StopBet("+intBT.toString()+", "+intNum+")' class='G_Con_Numer_blue' id='NumSB93_"+intSNum.toString()+"' style='color: "+strColor+"'>" + strNum + "</a>";
		//objNTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Ball";
		objNTD.className = "G_Con_TD_Ball";
		objOTD.className = (arrTmpGame[intNum][6] == "1")?"G_Con_TD_Dark":"G_Con_TD_Odds";

		objOTD.innerHTML = strCon;
	}
	document.getElementById("TwinSumStake").innerHTML = sumStake[intBT];
}

//顯示賠率視窗
function ShowOddsLayer(intGID, intBT, intNum, flOdds, intSiteNum){
	var strTD = "";
	if(intSiteNum == null)intSiteNum = intNum;
	with(document.OddsLayer){
		op.value = "OddsUpdate";
		GambleID.value = intGID;
		Bet_Type.value = intBT;
		intNumber.value = intNum;
		Odds.value = flOdds;
	}

	switch(intBT){
		case 64:
		case 65:
		case 66:
		case 67:
			strTD = "OddsTD64_"+intSiteNum;
			break;

		default:
			strTD = "OddsTD"+intBT+"_"+intSiteNum;
			break;
	}
	//alert(strTD);
	document.getElementById("odds_win").style.top = document.getElementById(strTD).offsetTop + document.getElementById(strTD).clientHeight+56;
	document.getElementById("odds_win").style.left = document.getElementById(strTD).offsetLeft;
	document.getElementById("odds_win").style.display = "block";
	close_WagerWin();
}

//關閉賠率視窗
function close_OddsWin(){
	document.getElementById("odds_win").style.display = "none";
}
//關閉明細視窗
function close_WagerWin(){
	document.getElementById("wager_win").style.display = "none";
}
function OnOff_QuickTable(isOn){
	//ExtraSetupTable.style.display = (isOn == 1)?"block":"none";
}
//開放停押，所有號碼和項目
function StopAllBet(isStop, strBT, strNum){
	with(document.getDataForm){
		op.value = "StopBet";
		isStopBet.value = isStop;
		Bet_Type.value = strBT;
		strLottoNumber.value = strNum;
		submit();
	}
}
//開放停押，雙飛全部號碼
function StopTwinAllBet(isStop){
	StopAllBet(isStop, strBetType, "");
	ResetTwinNumber();
}
//開放停押，三定位全部號碼
function StopTrinAllBet(isStop){
	StopAllBet(isStop, strBetType, "");
}
//開放停押，所有部分號碼
function StopSomeNumerBet(isStop){
	if(strBetType == "92"){
		StopAllBet(isStop, document.getDataForm["Bet_Type"].value, GetTrinOpTypeNum());
	}else if(strBetType == "93"){
		StopAllBet(isStop, document.getDataForm["Bet_Type"].value, Get3WordOpTypeNum());
	}else{
		StopAllBet(isStop, document.getDataForm["Bet_Type"].value, GetOpTypeNum());
		ResetTwinNumber();
	}
}
//開放停押，只單一號碼或項目
function StopBet(intBT, intNum){
	var objGame = eval("Game" + intBT);
	with(document.getDataForm){
		isStopBet.value = (objGame[intNum][6] == "0")?1:0;
		op.value = "StopBet";
		Bet_Type.value = intBT;
		switch(intBT){
			case 52:
			case 53:
			case 55:
			case 56:
			case 58:
			case 59:
			case 62:
			case 63:
			case 84:
			case 85:
			case 86:
				strLottoNumber.value = "0,1";
				break;
			case 92:
			case 93:
				strLottoNumber.value = objGame[intNum][3];
				break;
			default:
				strLottoNumber.value = intNum;
				break;
		}
		submit();
	}
}
//取得操作種類號碼，回傳號碼用逗號組合字串
function GetOpTypeNum(){
	var i = 0, ii = "", j = 0, strNum = "";
	var intLNum = 0, intRNum = 0, intSum = 0;
	var intOverNumber = 50;
	var intSOverNumber = 10;
	var isSelectNum = false;

	for(i = 0; i < 100; i++){
		if(strBetType == "67"){
			if(Math.floor(i / 10) > (i % 10))continue;
		}

		ii = (i >= 10)?i.toString():"0"+i.toString();
		isSelectNum = false;
		document.getElementById("Num64_"+i.toString()).style.background = "#FFFFFF";
		//是否單號
		if(document.OddsListForm["OpType1"].checked){
			if(i % 2 == 1)isSelectNum = true;
		}
		//是否雙號
		if(document.OddsListForm["OpType2"].checked){
			if(i % 2 == 0)isSelectNum = true;
		}
		//是否大號
		if(document.OddsListForm["OpType3"].checked){
			if(i >= parseInt(intOverNumber))isSelectNum = true;
		}
		//是否小號
		if(document.OddsListForm["OpType4"].checked){
			if(i < parseInt(intOverNumber))isSelectNum = true;
		}
	    intLNum = eval(ii.substr(0,1));
	    intRNum = eval(ii.substr(1,1));
	    intSum = intLNum + intRNum;
		//是否合單
		if(document.OddsListForm["OpType5"].checked){
			if(intSum % 2 == 1)isSelectNum = true;
		}
		//是否合雙
		if(document.OddsListForm["OpType6"].checked){
			if(intSum % 2 == 0)isSelectNum = true;
		}
		//是否合大
		if(document.OddsListForm["OpType7"].checked){
			if(intSum >= intSOverNumber)isSelectNum = true;
		}
		//是否合小
		if(document.OddsListForm["OpType8"].checked){
			if(intSum < intSOverNumber)isSelectNum = true;
		}
		//是否十個同號
		if(document.OddsListForm["OpType9"].checked){
			if(intLNum == intRNum)isSelectNum = true;
		}
		for(j = 0; j < 10; j++){
			//個位
			if(document.OddsListForm["CBx" + j].checked){
				if(i % 10 == j)isSelectNum = true;
			}
			//十位
			if(document.OddsListForm["CB" + j + "x"].checked){
				if(Math.floor(i / 10) == j)isSelectNum = true;
			}
		}

		if(isSelectNum){
			strNum += i.toString() + ",";
			document.getElementById("Num64_"+i.toString()).style.background = "#FFFF00";
		}
	} //for(i = 0; i < 100; i++)
	return strNum.substr(0, (strNum.length - 1));
}
//取得操作種類號碼，回傳號碼用逗號組合字串
function GetTrinOpTypeNum(){
	var i = 0, ii = "", j = 0, strNum = "";
	var intNum = 0;
	var intOverNumber = 500;
	var isSelectNum = false;

	for(i = 0; i < 100; i++){
		intNum = document.getElementById("NumSB92_"+i.toString()).innerHTML*1;

		ii = (i >= 10)?i.toString():"0"+i.toString();
		isSelectNum = false;
		document.getElementById("Num92_"+i.toString()).style.background = "#FFFFFF";
		//是否單號
		if(document.OddsListForm["OpType1"].checked)if(intNum % 2 == 1)isSelectNum = true;
		//是否雙號
		if(document.OddsListForm["OpType2"].checked)if(intNum % 2 == 0)isSelectNum = true;
		//是否大號
		if(document.OddsListForm["OpType3"].checked)if(intNum >= intOverNumber)isSelectNum = true;
		//是否小號
		if(document.OddsListForm["OpType4"].checked)if(intNum < intOverNumber)isSelectNum = true;

		intN1 = Math.floor(intNum / 100); //百位
		intN2 = Math.floor(intNum / 10) % 10; //十位
		intN3 = intNum % 10; //個位
		//是否都不同號
		if(!isSelectNum && document.OddsListForm["SameNo1"].checked)if(intN1 != intN2 && intN2 != intN3 && intN1 != intN3)isSelectNum = true;
		//是否三個同號
		if(!isSelectNum && document.OddsListForm["SameNo3"].checked)if(intN1 == intN2 && intN2 == intN3 && intN1 == intN3)isSelectNum = true;
		//是否兩個同號
		if(!isSelectNum && document.OddsListForm["SameNo2"].checked)if((intN1 == intN2 || intN2 == intN3 || intN1 == intN3) && !(intN1 == intN2 && intN2 == intN3 && intN1 == intN3))isSelectNum = true;

		for(j = 0; j < 10; j++){
			//個位
			if(document.OddsListForm["CBx" + j].checked){
				if(i % 10 == j)isSelectNum = true;
			}
			//十位
			if(document.OddsListForm["CB" + j + "x"].checked){
				if(Math.floor(i / 10) == j)isSelectNum = true;
			}
		}

		if(isSelectNum){
			strNum += intNum.toString() + ",";
			document.getElementById("Num92_"+i.toString()).style.background = "#FFFF00";
		}
	} //for(i = 0; i < 100; i++)
	return strNum.substr(0, (strNum.length - 1));
}


//取得操作種類號碼，回傳號碼用逗號組合字串
function Get3WordOpTypeNum(){
	var i = 0, ii = "", j = 0, strNum = "", intN1 = 0, intN2 = 0, intN3 = 0;
	var intNum = 0;
	var intBT = parseInt(document.getDataForm.Bet_Type.value);
	var intOverNumber = 500;
	var strPoint = "93";
	var isSelectNum = false;
	var strSite = "";

	for(i = 0; i < 220; i++){
		strSite = strPoint+"_"+i.toString();
		intNum = document.getElementById("NumSB"+strSite).innerHTML*1;

		ii = (i >= 10)?i.toString():"0"+i.toString();
		isSelectNum = false;
		document.getElementById("Num"+strSite).className = 'G_Con_TD_Ball';
		//是否單號
		if(!isSelectNum && document.OddsListForm["OpType1"].checked)if(intNum % 2 == 1)isSelectNum = true;
		//是否雙號
		if(!isSelectNum && document.OddsListForm["OpType2"].checked)if(intNum % 2 == 0)isSelectNum = true;
		//是否大號
		if(!isSelectNum && document.OddsListForm["OpType3"].checked)if(intNum >= intOverNumber)isSelectNum = true;
		//是否小號
		if(!isSelectNum && document.OddsListForm["OpType4"].checked)if(intNum < intOverNumber)isSelectNum = true;

		intN1 = Math.floor(intNum / 100); //百位
		intN2 = Math.floor(intNum / 10) % 10; //十位
		intN3 = intNum % 10; //個位
		//是否都不同號
		if(!isSelectNum && document.OddsListForm["SameNo1"].checked)if(intN1 != intN2 && intN2 != intN3 && intN1 != intN3)isSelectNum = true;
		//是否三個同號
		if(!isSelectNum && document.OddsListForm["SameNo3"].checked)if(intN1 == intN2 && intN2 == intN3 && intN1 == intN3)isSelectNum = true;
		//是否兩個同號
		if(!isSelectNum && document.OddsListForm["SameNo2"].checked)if((intN1 == intN2 || intN2 == intN3 || intN1 == intN3) && !(intN1 == intN2 && intN2 == intN3 && intN1 == intN3))isSelectNum = true;

		if(isSelectNum == false){
			for(j = 0; j < 22; j++){
				if(j < 10){
					//個位
					if(document.OddsListForm["CBx" + j].checked)if(i % 10 == j)isSelectNum = true;

					if(document.OddsListForm["STrinityNo0" + j].checked)if(intN1 == j)isSelectNum = true;

					if(document.OddsListForm["STrinityNo1" + j].checked)if(intN2 == j)isSelectNum = true;

					if(document.OddsListForm["STrinityNo2" + j].checked)if(intN3 % 10 == j)isSelectNum = true;
				}
				//十位
				if(document.OddsListForm["CB" + j + "x"].checked){
					if(Math.floor(i / 10) == j)isSelectNum = true;
				}
				if(isSelectNum == true)break;
			}
		}

		if(isSelectNum){
			strNum += intNum.toString() + ",";
			document.getElementById("Num"+strSite).className = 'G_Con_TD_Ball_Select';
		}
	} //for(i = 0; i < 100; i++)
	return strNum.substr(0, (strNum.length - 1));
}


//取得賠率
function GetOdds(){
	with(document.getDataForm){
		document.getDataForm["Bet_Type"].value = strBetType;
		op.value = "GetOdds";
		submit();
	}
}

/*--判斷特定欄位值是否有填--*/
function isEmpty(str) { 
	for (var i = 0; i < str.length; i++)
		if (" " != str.charAt(i))return false; 
		return true; 
}

function checkOdds(){
	var arrNum = new Array();
	var objOdds = document.OddsLayer.Odds;
	var intBT = parseInt(document.OddsLayer.Bet_Type.value);

	if(isEmpty(objOdds.value)){
		alert("Odds is Empty");
		objOdds.focus();
		return false;
	}else if(isNaN(objOdds.value)){
		alert("Odds is String!!");
		objOdds.focus();
		return false;
	}else if(parseFloat(objOdds.value) <= 0){
		alert("Odds <= 0");
		objOdds.focus();
		return false;
	}

	var intNum = parseInt(document.OddsLayer.intNumber.value);
	arrNum[0] = document.OddsLayer.intNumber.value;
	if(document.OddsLayer.op.value == "MultiOddsUpdate"){
		arrNum = document.OddsLayer.strNumber.value.split(",");
	}

	for(var i = 0; i < arrNum.length; i++){
		var intNum = parseInt(arrNum[i]);
		if(null == arrGLineNumToApointNum[intBT][intNum]){
			var intAN = 0;
		}else{
			var intAN = arrGLineNumToApointNum[intBT][intNum];
		}
		//alert(intNum + "=" + intAN);

		if(parseFloat(objOdds.value) > MaxOdds[intBT][intAN]){
			alert("Error: Odds > "+MaxOdds[intBT][intAN]);
			objOdds.focus();
			return false;
		}
	}
	document.getElementById("odds_win").style.display = "none";
	return true;
}

//給選擇樂透種類下拉選單用
function LottoSelect(){
	with(document.OddsListForm){
		target = "_self";
		switch(LottoID.value){
			case "1":
				action = "/k_admin/Operate/index.php";
				break;

			case "2":
			case "3":
			case "6":
			case "7":
			case "8":
				action = "/k_admin/Operate3D/index.php";
				break;

			case "4":
				action = "/k_admin/Operate7Star/index.php";
				break;

			case "5":
				action = "/k_admin/Operate10M/index.php";
				break;
		}
		submit();
	}
}

//更改下注種類賠率表
function ChangeBet(intBT){
	close_WagerWin();
	close_OddsWin();
	document.OddsLayer.SpecialNumType.value = "0";
	document.getDataForm.SpecialNumType.value = "0";
	switch(intBT){
		//定膽
		case 51:
			document.getElementById("ListStatus").innerHTML = strT51;
			strBetType = "51,52,53,54,55,56,57,58,59,60,61,62,63,84,85,86";
			document.getDataForm["Bet_Type"].value = "51,52,53,54,55,56,57,58,59,60,61,62,63,84,85,86";
			iniNumber(51);
			break;

		//雙飛定位
		case 64:
		case 65:
		case 66:
			document.getElementById("ListStatus").innerHTML = strT64;
			strBetType = intBT;
			document.getDataForm["Bet_Type"].value = intBT;
			iniTwinNumer(intBT);
			document.getElementById("TwinTip"+intBT).style.color = "#FF9900";
			break;

		//雙飛不定位
		case 67:
			document.getElementById("ListStatus").innerHTML = strT67;
			strBetType = intBT;
			document.getDataForm["Bet_Type"].value = intBT;
			iniTwinNumer(intBT);
			break;

		//組 3 轉直
		case 68:
			document.getElementById("ListStatus").innerHTML = strT68;
			strBetType = "68,69,70,71,72";
			document.getDataForm["Bet_Type"].value = "68,69,70,71,72";
			iniAssembleNumer(68);
			break;

		// 組 6 轉直
		case 73:
			document.getElementById("ListStatus").innerHTML = strT73;
			strBetType = "73,74,75,76,77";
			document.getDataForm["Bet_Type"].value = "73,74,75,76,77";
			iniAssembleNumer(73);
			break;

		// 3x3x3
		case 78:
			document.getElementById("ListStatus").innerHTML = strT78;
			strBetType = "78,79,80,81,82,83";
			document.getDataForm["Bet_Type"].value = "78,79,80,81,82,83";
			iniRowsNumer(78);
			break;

		// 過關 跨度
		case 87:
			document.getElementById("ListStatus").innerHTML = strT87;
			strBetType = "87,88,89,90,91";
			document.getDataForm["Bet_Type"].value = "87,88,89,90,91";
			iniOPNumer(87);
			break;

		// 三定位
		case 92:
			document.getElementById("ListStatus").innerHTML = strT92;
			strBetType = "92";
			document.getDataForm["Bet_Type"].value = "92";
			iniTrinityNumber(92);
			break;

		// 三字
		case 93:
			document.getElementById("ListStatus").innerHTML = strT93;
			strBetType = "93";
			document.getDataForm["Bet_Type"].value = "93";
			ini3WordNumber(93);
			break;
	}
}

//顯示以開獎表格
function StartGame(){
	var KGame = new Array(), strGID = "", strBID = "";
	close_WagerWin();
	OnOff_QuickTable(0);
	document.getDataForm.op.value = "StartGame";
	document.getElementById("BetList").innerHTML = strLayerStart;
	document.getElementById("ListStatus").innerHTML = strTSG;
	var objOTable = document.getElementById("OddsTable");
	var docloc="getWagerStart.xml.php?LottoID="+strLottoID+"&isStop=0";
	if (document.implementation && document.implementation.createDocument) {
		KGameDOM = document.implementation.createDocument("", "", null);
	} else if (window.ActiveXObject) {
		KGameDOM = new ActiveXObject("Microsoft.XMLDOM");
		KGameDOM.async = false;
	}
	KGameDOM.load(docloc);
	var root = KGameDOM.documentElement;

	if(root == null)return;
	with(objOTable)	{
		while(rows.length > 1)	deleteRow(rows.length - 1);

		for (var i = 0; i < root.childNodes.length; i++) {
			newTR = insertRow();
			newTR.className = "G_Con_TR";
			with(newTR){
				if (root.childNodes.item(i).tagName == "WagerData") {
					KGame[i]=root.childNodes.item(i);
					newTD = insertCell();
					newTD.innerHTML = KGame[i].getElementsByTagName("GameDate").item(0).text + "&nbsp;" + KGame[i].getElementsByTagName("GameTime").item(0).text;

					newTD = insertCell();
					newTD.innerHTML = KGame[i].getElementsByTagName("GameNo").item(0).text;

					newTD = insertCell();
					newTD.align = "left";
					newTD.innerHTML = KGame[i].getElementsByTagName("BetType").item(0).text;

					strGID = KGame[i].getElementsByTagName("GambleID").item(0).text;
					strBID = KGame[i].getElementsByTagName("BID").item(0).text;
					newTD = insertCell();
					newTD.align = "left";
					newTD.id = "OddsTD"+strBID;
					if(document.getDataForm.isRealShow.value == "1"){
						newTD.innerHTML = "<a class=\"G_Con_Bet_Start\" href=\"JavaScript:getWagerData("+strGID+","+strBID+",-1,1,-1)\">"+KGame[i].getElementsByTagName("CountNo").item(0).text+"&nbsp;/&nbsp;"+KGame[i].getElementsByTagName("RateMemStake").item(0).text+"</a>";
					}else{
						newTD.innerHTML = "<a class=\"G_Con_Bet_Start\" href=\"JavaScript:getWagerData("+strGID+","+strBID+",-1,1)\">"+KGame[i].getElementsByTagName("CountNo").item(0).text+"&nbsp;/&nbsp;"+KGame[i].getElementsByTagName("AllMemStake").item(0).text+"</a>";
					}
				}
			}
		}
	}
}

//更改分盤顯示
function ChangeGambleType(obj){
	with(document.getDataForm){
		ChangeGameType.value = "Yes";
		GameType.value = obj.value;
		submit();
		ChangeGameType.value = "No";
	}
}

//重整方式
function RefreshType(){
	if(isEmergency == 1 && intEmergencyNo == 0){
		alert(strOnEmergency);
		intEmergencyNo++;
	}
	with(document.getDataForm){
		if(op.value == "StartGame"){
			StartGame();
		}else{
			GetOdds();
		}
	}
}

//定時重整
function RClock(i){
	if (RSeconds == 0){
		RefreshType();
		RSeconds = i;
	}
	RSeconds --;
	intEndGameTime --;
	if(document.getElementById("RSec"))document.getElementById("RSec").innerHTML = RSeconds;
	if(intEndGameTime == 0){
		document.getElementById("AlertStopWager").innerHTML = "<embed src='Lotto" + strLottoID + ".mp3' hidden='true'>";
	}
	if(intEndGameTime < -10 && AutoRefreshID > 0)clearInterval(AutoRefreshID);
}

//顯示虛貨，實貨方式
function ChangeReal(obj){
	document.getDataForm.isRealShow.value = obj.value;
	document.OddsLayer.isRealShow.value = obj.value;
	RefreshType();
}

//選擇定時時間
function ChangeRefreshSec(strSec){
	if(strSec == "")strSec = "120";
	if(AutoRefreshID > 0)clearInterval(AutoRefreshID);
	RSeconds = strSec*1;
	AutoRefreshID = setInterval("RClock("+strSec+")",1000);
}

//批次用賠率差調整賠率
function PlusMinusOdds(isAdd, intNum, intBT, flOdds){
	if(null == arrGLineNumToApointNum[intBT][intNum]){
		var intAN = 0;
	}else{
		var intAN = arrGLineNumToApointNum[intBT][intNum];
	}

	with(document.OddsLayer){
		op.value = "OddsUpdate";
		GapOdds.value = ((isAdd == 1)?"":"-")+arrJumpOdds[intBT][intAN];
		Odds.value = flOdds + parseFloat(GapOdds.value);
		intNumber.value = intNum;
		GambleID.value = document.getDataForm.GambleID.value;
		isSpecial.value = document.getDataForm.isSpecial.value;
		Bet_Type.value = intBT;
		submit();
	}
}

//批次用賠率差調整賠率
function MultiUpdateGapOdds(isAdd){
	with(document.OddsLayer){
		op.value = "MultiOddsUpdate";
		isGapUpdate.value = "1";
		GapOdds.value = ((isAdd == 1)?"":"-")+document.OddsListForm.GapOdds.value;
		switch(document.getDataForm["Bet_Type"].value){
			case "92":
				strNumber.value = GetTrinOpTypeNum();
				break;

			case "93":
				strNumber.value = Get3WordOpTypeNum();
				break;

			default:
				strNumber.value = GetOpTypeNum();
				break;
		}
		GambleID.value = document.getDataForm.GambleID.value;
		isSpecial.value = document.getDataForm.isSpecial.value;
		Bet_Type.value = strBetType;
		submit();
	}
}

//批次調整成同一賠率
function MultiUpdateOneOdds(){
	with(document.OddsLayer){
		op.value = "MultiOddsUpdate";
		isGapUpdate.value = "0";
		Odds.value = document.OddsListForm.Odds.value;
		switch(document.getDataForm["Bet_Type"].value){
			case "92":
				strNumber.value = GetTrinOpTypeNum();
				break;

			case "93":
				strNumber.value = Get3WordOpTypeNum();
				break;

			default:
				strNumber.value = GetOpTypeNum();
				break;
		}
		GambleID.value = document.getDataForm.GambleID.value;
		isSpecial.value = document.getDataForm.isSpecial.value;
		Bet_Type.value = strBetType;
		//if(checkOdds())
		submit();
	}
}

var KGameDOM;
function getWagerData(GID, BID, Num, isStop, CellNum) {
	var KGame = new Array(), strTD = "", intGap = 0;
	var objWTable = document.getElementById("WagerTable");
	var objWLayer = document.getElementById("WagerLayer");
	var strBID = BID;
	var docloc="getWager.xml.php?GambleID="+GID+"&Bet_Type="+strBID+"&Number="+Num+"&isStop="+isStop+"&isRealShow="+document.getDataForm.isRealShow.value;
	if(BID >= 69 && BID <= 77)docloc+="&isParlays=1";

	if (document.implementation && document.implementation.createDocument) {
		KGameDOM = document.implementation.createDocument("", "", null);
	} else if (window.ActiveXObject) {
		KGameDOM = new ActiveXObject("Microsoft.XMLDOM");
		KGameDOM.async = false;
	}
	KGameDOM.load(docloc);
	var root = KGameDOM.documentElement;

	if(root != null){
		if(Num == -1){
			strTD = "OddsTD"+BID;
		}else{
			switch(BID){
				case 64:
				case 65:
				case 66:
				case 67:
					strTD = "OddsTD64_"+CellNum;
					break;
				case 92:
				case 93:
					strTD = "OddsTD"+BID+"_"+CellNum;
					break;

				default:
					strTD = "WagerTD"+BID+"_"+CellNum;
					break;
			}
		}
		document.getElementById("wager_win").style.top = document.getElementById(strTD).offsetTop + document.getElementById(strTD).clientHeight+56+intGap;
		if(document.getElementById("OddsTable").clientWidth < document.getElementById(strTD).offsetLeft + 483){
			document.getElementById("wager_win").style.left = document.getElementById(strTD).offsetLeft + document.getElementById(strTD).clientWidth - 487;
		}else{
			document.getElementById("wager_win").style.left = document.getElementById(strTD).offsetLeft;
		}
		document.getElementById("wager_win").style.display = "block";
		close_OddsWin();
	}else{
		close_WagerWin();
		return;
	}
	with(objWTable)	{
		while(rows.length > 1)	deleteRow(rows.length - 1);

		for (var i = 0; i < root.childNodes.length; i++) {
			newTR = insertRow();
			newTR.className = "Account_Con_BG";
			with(newTR){
				if (root.childNodes.item(i).tagName == "WagerData") {
					KGame[i]=root.childNodes.item(i);
					newTD = insertCell();
					newTD.align = "left";
					newTD.innerHTML = KGame[i].getElementsByTagName("BetDate").item(0).text + "&nbsp;" + KGame[i].getElementsByTagName("BetTime").item(0).text + "<br />" + KGame[i].getElementsByTagName("BetNo").item(0).text;

					newTD = insertCell();
					newTD.align = "right";
					newTD.innerHTML = KGame[i].getElementsByTagName("Account").item(0).text;

					newTD = insertCell();
					newTD.innerHTML = KGame[i].getElementsByTagName("Content").item(0).text;

					newTD = insertCell();
					newTD.align = "right";
					if(KGame[i].getElementsByTagName("OneStake").item(0).text != ""){
						newTD.innerHTML = KGame[i].getElementsByTagName("OneStake").item(0).text + "<br /><br />" + KGame[i].getElementsByTagName("Stake").item(0).text;
					}else{
						newTD.innerHTML = KGame[i].getElementsByTagName("Stake").item(0).text;
					}

					newTD = insertCell();
					newTD.align = "right";
					newTD.innerHTML = KGame[i].getElementsByTagName("Income").item(0).text;
				}
			}
		}
	}
	objWLayer.style.height = (objWTable.clientHeight > 300)?300:objWTable.clientHeight;
}

function getNowWagerList(){
	window.open("showblack.php?LID="+strLottoID, "BlackWindow3D_<?php print str_replace(':', '', str_replace('.', '', $_SERVER["HTTP_HOST"])); ?>", "toolbar=no,width=540,height=400,top=0,left=0,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
}
//-->
</script>
</head>

<body class="Mybody" onload="iniNumber(51);">
<form action="index.php" target="_self" method="Get" name="OddsListForm">
<table class="G_Table" cellspacing="1" cellpadding="0">
<tr>
	<td colspan="10" class="MyUp">
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td align="right" class="G_Menu">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size: 1px">
	<tr>
		<td align="left"><a class="G_text"><?php print $_strOperate3D["LottoKind"];//種類：?><?php print MakeLottoSelect($_arrLotto, $intLID, "LottoID", "LottoSelect()", $_intLang)?></a></td>
		<td align="left">
		<select onchange="ChangeReal(this)">
			<option value="0">-<?php print $_strOperate3D["AllBet"];?>-</option>
			<option value="1" selected>-<?php print $_strOperate3D["RealBet"];?>-</option>
		</select>&nbsp;
		<a class="G_text"><?php print $_strOperate3D["RefreshWay"];//更新：?></a>
		<select onchange="ChangeRefreshSec(this.value)">
			<option value="">-No-</option>
			<option value="5">5 sec</option>
			<option value="10">10 sec</option>
			<option value="20">20 sec</option>
			<option value="30">30 sec</option>
			<option value="40">40 sec</option>
			<option value="50">50 sec</option>
			<option value="60">60 sec</option>
		</select>&nbsp;<input type="button" class="submit" value="<?php print $_strOperate3D["Refresh"];//重新整理?>" onclick="RefreshType();"> </td>
		<td align="left"><a class="G_text"><?php print $_strOperate3D["LineKind"];//分盤：?></a>
		<select name="GambleType" onchange="ChangeGambleType(this)">
		<?php
			$arrLine = split(",", $_KSysParam[GambleLineShowSetting]);
			foreach($arrLine as $k => $v){
				if(empty($v))continue;
				if($_data["GameType"] == $k){
					print '<option value="'.$k.'" selected>'.$v.'</option>\n';
				}else{
					print '<option value="'.$k.'">'.$v.'</option>\n';
				}
			}
		?>
		</select>
		</td>
		<td align="right" valign="bottom" width="510" style="font-size: <?php print ($_intLang == 3)?"1":"8";?>px">
		<!--########## 定膽 ##########//-->
			<a href="JavaScript:ChangeBet(51)" id="M_OETG" class="while_link"><?php print $_strOperate3D["Bet51"];//定膽?></a>
		<!--########## 雙飛定位 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(64)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet64"];//雙飛定位?></a>
		<!--########## 雙飛不定位 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(67)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet67"];//雙飛不定位?></a>
		<!--########## 三定位 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(92)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet92"];//三定位?></a>
		<!--########## 三字 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(93)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet93"];//三字?></a>
		<!--########## 組 3 轉直下注 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(68)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet68"];//組 3 轉直?></a>
		<!--########## 組 6 轉直下注 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(73)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet73"];//組 6 轉直?></a>
		<!--########## 3x3x3 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(78)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet78"];//3x3x3?></a>
		<!--########## 過關 跨度 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:ChangeBet(87)" id="M_CS" class="while_link"><?php print $_strOperate3D["Bet87"];//過關 跨度?></a>
		<!--########## 已開獎 ##########//-->
			&nbsp;<a class="a_text">|</a>&nbsp;
			<a href="JavaScript:StartGame()" id="M_CS" class="while_link"><?php print $_strOperate3D["StartGame"];//已開獎?></a>
		</td>
	</tr>
</table>
				</td>
			</tr>
		</table>
	</td>
</tr>
<tr>
	<td colspan="10" class="G_OutSubMenu">
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td align="right" class="G_SubMenu">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td align="left" class="G_SubMenuCon" width="60%"><?php print $_strOperate3D["ListStatus"];//目前表單狀態：?><a id="ListStatus" class="G_Sec">Special Ball</a>&nbsp;--&nbsp;<?php print $_strOperate3D["GameNo"];//期數?><b style="font-size: 16">&nbsp;:&nbsp;</b><a class="G_Sec"><?php print $arrGamble["SerialNo"];?></a>&nbsp;--&nbsp;<?php print $_strOperate3D["GameTime"];//時間?><b style="font-size: 16">&nbsp;:&nbsp;</b><a class="G_Sec"><?php print $_strGDate;?></a></td>
		<td align="center" class="G_SubMenuCon">&lt;&lt;<a href="JavaScript:getNowWagerList()"><?php print $_strOperate3D["NowWagerList"];//即時注單?></a>&gt;&gt;</td>
		<td align="right" class="G_SubMenuCon" width="15%"><?php print $_strOperate3D["RefreshSec"];//更新秒數：?><a class="G_Sec" id="RSec">--</a></td>
	</tr>
</table>
				</td>
			</tr>
		</table>
	</td>
</tr>
<tr>
	<td><span id="BetList"></span></td>
</tr>
</table>
</form>

<!----------------------號碼視窗---------------------------->
<div id="odds_win" style="display: none;position:absolute">
<form name="OddsLayer" action="index.php" method="Get" target="getData" onsubmit="return checkOdds();">
<input type="hidden" name="op" value="OddsUpdate">
<input type="hidden" name="rop" value="GetOdds">
<input type="hidden" name="LottoID" value="<?php print $intLID;?>">
<input type="hidden" name="GambleID" value="">
<input type="hidden" name="Bet_Type" value="">
<input type="hidden" name="intNumber" value="">
<input type="hidden" name="strNumber" value="">
<input type="hidden" name="GapOdds" value="">
<input type="hidden" name="isGapUpdate" value="">
<input type="hidden" name="isSpecial" value="1">
<input type="hidden" name="isRealShow" value="1">
<input type="hidden" name="SpecialNumType" value="3">
<table width="120" border="0" cellspacing="1" cellpadding="2" bgcolor="00558E">
<tr>
	<td bgcolor="#FFFFFF">
		<table width="120" border="0" cellspacing="0" cellpadding="0" class="m_tab_fix" >
			<tr bgcolor="0163A2"> 
				<td width="100" style="font-size:12px"><font color="#FFFFFF">&nbsp;Change Odds</td>
				<td align="right" valign="top" ><a style="cursor:hand;" onClick="close_OddsWin();"><img src="/images/k_admin/edit_dot.gif" width="16" height="14"></a></td>
			</tr>
			<tr bgcolor="#000000"> 
				<td colspan="2" height="1"></td>
			</tr>
        <tr bgcolor="#FFCC66"> 
          <td colspan="2">
		  <table border="0" cellspacing="0" cellpadding="0" width="120">
			  <tr>
				<td width="80" align="center"><input type="text" name="Odds" size="9" onpaste="return event.returnValue = false;"></td>
				<td width="20" align="right"><input type="submit" class="submit" value="<?php print $_strOperate3D["Send"];?>"></td>
			  </tr>
		  </table>
		  </td>
        </tr>
      </table>
    </td>
</tr>
</table>
</form>
</div>
<!----------------------號碼視窗----------------------------> 
<!----------------------下注明細圖層---------------------------->
<div id="wager_win" style="display: none;position:absolute">
<table width="120" border="0" cellspacing="1" cellpadding="2" bgcolor="00558E">
<tr><td bgcolor="#FFFFFF">
<table width="120" border="0" cellspacing="0" cellpadding="0" class="m_tab_fix" >
<tr bgcolor="0163A2"> 
<td width="100" style="font-size:12px"><font color="#FFFFFF">&nbsp;<?php print $_strOperate3D["WagerList"];?></td>
<td align="right" valign="top" ><a style="cursor:hand;" onClick="close_WagerWin();"><img src="/images/k_admin/edit_dot.gif" width="16" height="14"></a></td>
</tr>
<tr bgcolor="#000000"><td colspan="2" height="1"></td></tr>
<tr bgcolor="#FFCC66"> 
<td colspan="2">
<div style="height:300px; overflow:auto; overflow-x:hidden;" id="WagerLayer">
<table id="WagerTable" class="MyTable" cellspacing="1" cellpadding="3" style="width: 483px;">
<tr align="center">
	<td width="60" class="MyTitleL"><?php print $_strOperate3D["WGameTime"];?></td>
	<td width="80" class="MyTitleL"><?php print $_strOperate3D["WAccount"];?></td>
	<td width="170" class="MyTitleL"><?php print $_strOperate3D["WCont"];?></td>
	<td width="70" class="MyTitleL"><?php print $_strOperate3D["WStake"];?></td>
	<td width="70" class="MyTitleL"><?php print $_strOperate3D["WResult"];?></td>
</tr>
</table>
</div>
</td></tr></table>
</td></tr></table>
</div>
<!----------------------下注明細圖層---------------------------->
<iframe src="" width="<?php print ($_SESSION["Admin_Info"] -> MemberGroup == 31)?"110":"0";?>" height="<?php print ($_SESSION["Admin_Info"] -> MemberGroup == 31)?"110":"0";?>" name="getData" id="getDataIFrame"></iframe>
<form action="index.php" target="getData" name="getDataForm">
<input type="hidden" name="op" value="GetOdds">
<input type="hidden" name="LottoID" value="<?php print $intLID;?>">
<input type="hidden" name="GambleID" value="<?php print $intGID;?>">
<input type="hidden" name="Bet_Type" value="">
<input type="hidden" name="isSpecial" value="1">
<input type="hidden" name="isStopBet" value="1">
<input type="hidden" name="intEmergency" value="0">
<input type="hidden" name="isRealShow" value="1">
<input type="hidden" name="strLottoNumber" value="<?php print $_strNumber;?>">
<input type="hidden" name="ChangeGameType" value="No">
<input type="hidden" name="GameType" value="<?php print $_data["GameType"];?>">
<input type="hidden" name="SpecialNumType" value="3">
<input type="hidden" name="OtherMsg" value="">
</form>

<div id="AlertStopWager"></div>
</body>
</html>